load("//rs/tests:common.bzl", "COUNTER_CANISTER_RUNTIME_DEPS", "MESSAGE_CANISTER_ENV", "MESSAGE_CANISTER_RUNTIME_DEPS", "UNIVERSAL_CANISTER_ENV", "UNIVERSAL_CANISTER_RUNTIME_DEPS")
load("//rs/tests:system_tests.bzl", "system_test")

package(default_visibility = ["//rs:system-tests-pkg"])

II_DEV_CANISTER_RUNTIME_DEPS = [
    # Keep sorted.
    "@ii_dev_canister//file",
]

DEPENDENCIES = [
    "//packages/ic-ed25519",
    "//packages/ic-secp256k1",
    "//packages/ic-secp256r1",
    "//rs/crypto/internal/crypto_lib/basic_sig/der_utils",
    "//rs/crypto/internal/crypto_lib/bls12_381/type",
    "//rs/crypto/sha2",
    "//rs/crypto/test_utils",
    "//rs/crypto/test_utils/reproducible_rng",
    "//rs/ic_os/fstrim_tool",
    "//rs/registry/subnet_type",
    "//rs/tests/consensus/utils",
    "//rs/tests/driver:ic-system-test-driver",
    "//rs/types/types",
    "//rs/universal_canister/lib",
    "@crate_index//:anyhow",
    "@crate_index//:base64",
    "@crate_index//:candid",
    "@crate_index//:ic-agent",
    "@crate_index//:ic-certification",
    "@crate_index//:k256",
    "@crate_index//:p256",
    "@crate_index//:rand",
    "@crate_index//:reqwest",
    "@crate_index//:rsa",
    "@crate_index//:simple_asn1",
    "@crate_index//:serde",
    "@crate_index//:serde_bytes",
    "@crate_index//:serde_cbor",
    "@crate_index//:serde_json",
    "@crate_index//:slog",
    "@crate_index//:tokio",
]

system_test(
    name = "canister_sig_verification_cache_test",
    env = {
        "II_WASM_PATH": "$(rootpath @ii_dev_canister//file)",
    },
    runtime_deps = COUNTER_CANISTER_RUNTIME_DEPS + II_DEV_CANISTER_RUNTIME_DEPS,
    deps = DEPENDENCIES,
)

system_test(
    name = "request_signature_test",
    env = UNIVERSAL_CANISTER_ENV,
    runtime_deps = UNIVERSAL_CANISTER_RUNTIME_DEPS,
    deps = DEPENDENCIES,
)

system_test(
    name = "rpc_csp_vault_reconnection_test",
    env = MESSAGE_CANISTER_ENV,
    runtime_deps = MESSAGE_CANISTER_RUNTIME_DEPS,
    deps = DEPENDENCIES,
)

system_test(
    name = "ic_crypto_csp_metrics_test",
    deps = DEPENDENCIES,
)

system_test(
    name = "ic_crypto_csp_socket_test",
    deps = DEPENDENCIES,
)

system_test(
    name = "ic_crypto_csp_umask_test",
    deps = DEPENDENCIES,
)

system_test(
    name = "ic_crypto_fstrim_tool_test",
    deps = DEPENDENCIES,
)

system_test(
    name = "ingress_verification_test",
    env = UNIVERSAL_CANISTER_ENV,
    runtime_deps = UNIVERSAL_CANISTER_RUNTIME_DEPS,
    deps = DEPENDENCIES,
)
